Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Determining Object Types

QuickDraw 3D provides routines that you can use to determine the type and name of a QuickDraw 3D object. Object types are declared as follows:

typedef long        TQ3ObjectType;

Q3Object_GetType

You can use the Q3Object_GetType function to get the type of a core QuickDraw 3D object.

TQ3ObjectType Q3Object_GetType (TQ3Object object);
object
A QuickDraw 3D object.

DESCRIPTION

The Q3Object_GetType function returns, as its function result, the type identifier of the QuickDraw 3D object specified by the object parameter. If successful, Q3Object_GetType returns one of these constants:

kQ3ObjectTypeElement
kQ3ObjectTypePick
kQ3ObjectTypeShared
kQ3ObjectTypeView

If the type cannot be determined or is invalid, Q3Object_GetType returns the value kQ3ObjectTypeInvalid .

ERRORS

kQ3ErrorNULLParameter kQ3ErrorInvalidObjectParameter

Q3Object_GetLeafType

You can use the Q3Object_GetLeafType function to get the leaf type of a QuickDraw 3D object.

TQ3ObjectType Q3Object_GetLeafType (TQ3Object object);
object
A QuickDraw 3D object.

DESCRIPTION

The Q3Object_GetLeafType function returns, as its function result, the leaf type identifier of the QuickDraw 3D object specified in the object parameter. You should call this function only when the specified object is a leaf object (for example, when you've read the object in from a file). If the leaf type cannot be determined or is invalid, Q3Object_GetLeafType returns the value kQ3ObjectTypeInvalid .

ERRORS

kQ3ErrorNULLParameter kQ3ErrorInvalidObjectParameter

Q3Object_IsType

You can use the Q3Object_IsType function to determine whether a QuickDraw 3D object is of a specific type.

TQ3Boolean Q3Object_IsType (
                     TQ3Object object,
                     TQ3ObjectType type);
object
A QuickDraw 3D object.
type
A type identifier.

DESCRIPTION

The Q3Object_IsType function returns a Boolean value that indicates whether the QuickDraw 3D object specified by the object parameter is of the type specified by the type parameter ( kQ3True ) or is of some other type ( kQ3False ). You can pass any valid QuickDraw 3D type identifier in the type parameter (not just those that are returned by the Q3Object_GetType function). For example, you can use Q3Object_IsType like this:

if (Q3Object_IsType(
        object,
        kQ3ShapeType_Geometry) {
    ...
} else if (Q3Object_IsType(
        object,
        kQ3SharedType_File)) {
    ...

ERRORS

kQ3ErrorNULLParameter kQ3ErrorInvalidObjectParameter


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |